package cn.tedu.vrd01test.controller;

import cn.tedu.vrd01test.entity.User;
import cn.tedu.vrd01test.entity.Works;
import cn.tedu.vrd01test.mapper.WorksMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class WorksController {
    @Autowired(required = false)
    WorksMapper mapper;

    @RequestMapping("/viewlist")
    public List<Works> viewList(){
        return mapper.selectViewList();
    }

    @RequestMapping("/newlist")
    public List<Works> newList(){
        return mapper.selectNewList();
    }

    @RequestMapping("/userlist")
    public List<User> userList(){
        return mapper.selectUserList();
    }

    @RequestMapping("/select")
    public Works selectById(int id){
        return mapper.selectById(id);
    }
    @RequestMapping("/selectAuthor")
    public Works selectByName(String author){
        return mapper.selectByName(author);
    }
}
